﻿#region using
using System.Collections.Generic;
using System.Threading.Tasks;
using SilverCrmSoap.CrmSdk;

#endregion

namespace SLTimeZoneHelper.CRM2011
{
   public partial class TimeZoneAdapter
   {
      public async Task<TimeZone> GetTimeZoneAsync(int zoneCode)
      {
         EntityCollection collection = await Task<EntityCollection>.Factory.FromAsync(Proxy.BeginRetrieveMultiple, Proxy.EndRetrieveMultiple, TimeZoneQueryHelper.DefaultTimeZoneQuery(zoneCode), Proxy);
         return TimeZoneQueryHelper.ParseDefaultTimeZoneResponse(collection);
      }

      public async Task<List<TimeZone>> GetAllTimeZonesAsync()
      {
         EntityCollection collection = await Task<EntityCollection>.Factory.FromAsync(Proxy.BeginRetrieveMultiple, Proxy.EndRetrieveMultiple, TimeZoneQueryHelper.DefaultTimeZoneQuery(), Proxy);
         return TimeZoneQueryHelper.ParseDefaultTimeZonesResponse(collection);
      }
   }
}